package com.jpc.kotlinnoteapplication.ui.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.jpc.kotlinnoteapplication.R
import com.jpc.kotlinnoteapplication.logic.model.Note

class RecyclerNoteItemAdapter(private val context: Context, private val itemList: List<Note>): RecyclerView.Adapter<ViewHolder>() {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val view = LayoutInflater.from(parent.context).inflate(R.layout.item_note, parent, false)
        return ItemViewHolder(view)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val viewHolder = holder as ItemViewHolder
        //viewHolder.ivNote =
    }

    override fun getItemCount() = itemList.size

    inner class ItemViewHolder(view: View): ViewHolder(view){
        val ivNote = view.findViewById<com.makeramen.roundedimageview.RoundedImageView>(R.id.iv_note)
        val tvTitle = view.findViewById<TextView>(R.id.tv_title)
        val tvSubTitle = view.findViewById<TextView>(R.id.tv_sub_title)
        val tvDateTime = view.findViewById<TextView>(R.id.tv_date_time)
    }
}